//這是對XDialog的封裝

<template>
  <x-dialog :show="showDialog" hide-on-blur mask-transition="xxx">
    <div class="x_dialog_comp">
      <div class="title">{{message}}</div>
      <div class="btn_wrap flex_box box_items_between">
        <div class="btn_list box_auto" @click="cancelBtn">{{cancelText}}</div>
        <div class="btn_list box_auto" @click="confirmBtn">{{confirmText}}</div>
      </div>
    </div>
  </x-dialog>
</template>

<script>
import { XDialog } from "vux";

export default {
  components: { XDialog },
  data() {
    return {};
  },

  props: {
    isShow: {
      type: Boolean,
      required: false,
      default: false
    },
    title: {
      type: String,
      required: false
    },
    message: {
      type: String,
      required: true
    },
    cancelText: {
      type: String,
      required: false,
      default: "取消"
    },
    confirmText: {
      type: String,
      required: false,
      default: "確定"
    }
  },
  methods: {
    //點擊取消
    cancelBtn() {
      this.$emit("onCancel", {});
    },
    //點擊確定
    confirmBtn() {
      this.$emit("onConfirm", {});
    }
  },
  mounted() {},
  computed: {
    showDialog: function() {
      return this.isShow;
    }
  }
};
</script>

<style lang="scss" scoped>
.x_dialog_comp {
  border-radius: 14px;
  text-align: center;
  background: #fff;
  padding: 90px 40px 40px 40px;
  font-weight: 500;
  width: 95%;
  margin: 0 auto;

  .title {
    font-size: 32px;
  }

  .btn_wrap {
    margin-top: 80px;

    .btn_list {
      height: 64px;
      border-radius: 8px;
      font-size: 26px;
      color: #fff;
      flex: 1;
    }

    :nth-child(1) {
      background: $btnColorDepict;
      margin-right: 16px;
    }

    :nth-child(2) {
      background: $mainColor;
    }
  }
}
</style>
